[HVM] Speed up bulk p2m operations such as domain creation
authorTim Deegan <Tim.Deegan@xensource.com>
Mon, 12 Mar 2007 09:44:34 +0000 (09:44 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Mon, 12 Mar 2007 09:44:34 +0000 (09:44 +0000)
by not flushing the shadows more often than is needed.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c
xen/include/asm-x86/domain.h

index 4907736299344cf0cec0291d144cf598bd91c685..15ebf1d541eb0887bf30c8fd61c5896eedc2027e 100644 (file)
@@ -2813,7 +2813,11 @@ shadow_write_p2m_entry(struct vcpu *v, unsigned long gfn, l1_pgentry_t *p,
        This is pretty heavy handed, but this is a rare operation
        (it might happen a dozen times during boot and then never
        again), so it doesn't matter too much. */
-    shadow_blow_tables(d);
+    if ( d->arch.paging.shadow.has_fast_mmio_entries )
+    {
+        shadow_blow_tables(d);
+        d->arch.paging.shadow.has_fast_mmio_entries = 0;
+    }
 #endif
 
     shadow_unlock(d);
index 581ab45196aacde65504b19ce9f6fc42638d515c..108c2e692d05667349ad39eff2b4ca54400ba826 100644 (file)
@@ -660,6 +660,8 @@ _sh_propagate(struct vcpu *v,
     {
         /* Guest l1e maps MMIO space */
         *sp = sh_l1e_mmio(guest_l1e_get_gfn(*gp), gflags);
+        if ( !d->arch.paging.shadow.has_fast_mmio_entries )
+            d->arch.paging.shadow.has_fast_mmio_entries = 1;
         goto done;
     }
 
index 94791f7a8042e3943fe7b207dc163bb20ef87a83..6c88e5abb0773bcfbfdbf1f6e0b7f7826199c9a1 100644 (file)
@@ -79,6 +79,9 @@ struct shadow_domain {
     struct shadow_page_info **hash_table;
     int hash_walking;  /* Some function is walking the hash table */
 
+    /* Fast MMIO path heuristic */
+    int has_fast_mmio_entries;
+
     /* Shadow log-dirty bitmap */
     unsigned long *dirty_bitmap;
     unsigned int dirty_bitmap_size;  /* in pages, bit per page */